package edu.fiu.cis.personalize.server.berkDB.serializers;

import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;

import edu.fiu.cis.personalize.server.graph.Query;
import edu.fiu.cis.personalize.server.graph.store.CountingConcMap;
import edu.fiu.cis.personalize.server.graph.store.NodeEdges;

public class QuerySerializer extends NodeSerializer<Query> {
	
	private CountingConcMapSerializer ser = new CountingConcMapSerializer();


	@Override
	public void objectToEntry(Query node, TupleOutput to) {
		super.objectToEntry(node, to);
		ser.objectToEntry(node.getDisplaysDocuments(), to);
		ser.objectToEntry(node.getSubmittedByUser(), to);
	}


	@Override
	protected Query process(TupleInput ti, int id, String gname,
			NodeEdges nodeEdges, double rank) {
		
		CountingConcMap dd = (CountingConcMap)ser.entryToObject(ti);
		CountingConcMap su = (CountingConcMap)ser.entryToObject(ti);
		return Query.create(id, gname, nodeEdges, rank,dd,su);
	}

	
}
